<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AI智能助手 - MVP原型</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            line-height: 1.6;
            color: #333;
            background-color: #f5f5f5;
            display: flex;
            justify-content: center;
            min-height: 100vh;
            padding: 20px;
        }
        
        .container {
            width: 100%;
            max-width: 800px;
            background: white;
            border-radius: 12px;
            box-shadow: 0 2px 20px rgba(0,0,0,0.1);
            overflow: hidden;
        }
        
        .header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 20px;
            text-align: center;
        }
        
        .header h1 {
            font-size: 24px;
            font-weight: 600;
        }
        
        .chat-container {
            height: 500px;
            padding: 20px;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 15px;
        }
        
        .message {
            max-width: 70%;
            padding: 12px 18px;
            border-radius: 18px;
            word-wrap: break-word;
        }
        
        .user-message {
            background-color: #e3f2fd;
            align-self: flex-end;
            border-bottom-right-radius: 4px;
        }
        
        .ai-message {
            background-color: #f1f1f1;
            align-self: flex-start;
            border-bottom-left-radius: 4px;
        }
        
        .input-container {
            padding: 20px;
            background: #fafafa;
            border-top: 1px solid #eee;
            display: flex;
            gap: 10px;
        }
        
        #message-input {
            flex: 1;
            padding: 12px 16px;
            border: 2px solid #ddd;
            border-radius: 24px;
            font-size: 16px;
            outline: none;
            transition: border-color 0.3s;
        }
        
        #message-input:focus {
            border-color: #667eea;
        }
        
        #send-button {
            background: #667eea;
            color: white;
            border: none;
            padding: 12px 24px;
            border-radius: 24px;
            font-size: 16px;
            cursor: pointer;
            transition: background-color 0.3s;
        }
        
        #send-button:hover {
            background: #5a67d8;
        }
        
        #send-button:disabled {
            background: #ccc;
            cursor: not-allowed;
        }
        
        .loading {
            display: inline-block;
            width: 20px;
            height: 20px;
            border: 3px solid #f3f3f3;
            border-top: 3px solid #667eea;
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin-left: 10px;
        }
        
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        
        .status-message {
            text-align: center;
            color: #666;
            font-style: italic;
            margin: 10px 0;
        }
        
        @media (max-width: 600px) {
            .message {
                max-width: 85%;
            }
            
            .chat-container {
                height: 400px;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>AI智能助手 - MVP原型</h1>
        </div>
        
        <div class="chat-container" id="chat-container">
            <div class="ai-message">
                你好！我是AI助手，有什么可以帮助你的吗？
            </div>
        </div>
        
        <div class="input-container">
            <input 
                type="text" 
                id="message-input" 
                placeholder="请输入你的问题..."
                autocomplete="off"
            >
            <button id="send-button">发送</button>
        </div>
    </div>
    
    <script>
        // 模拟数据 - 实际项目中应替换为真实的API调用
        const mockResponses = [
            "很高兴见到你！我是AI助手，随时为你提供帮助。",
            "这是一个很好的问题！让我来为你解答...",
            "根据你的需求，我推荐以下解决方案...",
            "我理解你的问题，让我详细解释一下...",
            "谢谢你的提问！这里有一些相关信息..."
        ];
        
        // DOM元素
        const chatContainer = document.getElementById('chat-container');
        const messageInput = document.getElementById('message-input');
        const sendButton = document.getElementById('send-button');
        
        // 发送消息
        function sendMessage() {
            const message = messageInput.value.trim();
            if (!message) return;
            
            // 添加用户消息
            addMessage(message, 'user');
            messageInput.value = '';
            
            // 禁用发送按钮
            sendButton.disabled = true;
            
            // 模拟思考中...
            setTimeout(() => {
                // 模拟AI回复
                const randomResponse = mockResponses[Math.floor(Math.random() * mockResponses.length)];
                addMessage(randomResponse, 'ai');
                
                // 启用发送按钮
                sendButton.disabled = false;
            }, 1000);
        }
        
        // 添加消息到聊天容器
        function addMessage(text, type) {
            const messageDiv = document.createElement('div');
            messageDiv.classList.add('message');
            messageDiv.classList.add(type === 'user' ? 'user-message' : 'ai-message');
            messageDiv.textContent = text;
            
            chatContainer.appendChild(messageDiv);
            chatContainer.scrollTop = chatContainer.scrollHeight;
        }
        
        // 事件监听
        sendButton.addEventListener('click', sendMessage);
        
        messageInput.addEventListener('keypress', (e) => {
            if (e.key === 'Enter') {
                sendMessage();
            }
        });
        
        // 真实API调用示例 (在实际项目中使用)
        function callDeepSeekAPI(message) {
            // 这里是实际的API调用代码
            /*
            fetch('https://api.deepseek.com/chat/completions', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json',
                    'Authorization': 'Bearer ' + YOUR_API_KEY
                },
                body: JSON.stringify({
                    model: 'deepseek-chat',
                    messages: [
                        {role: 'system', content: 'You are a helpful assistant'},
                        {role: 'user', content: message}
                    ],
                    stream: false
                })
            })
            .then(response => response.json())
            .then(data => {
                const aiResponse = data.choices[0].message.content;
                addMessage(aiResponse, 'ai');
            })
            .catch(error => {
                console.error('API调用错误:', error);
                addMessage('抱歉，发生了错误。请稍后再试。', 'ai');
            });
            */
        }
    </script>
</body>
</html>